
//noipnoi题解

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5e5 + 5;
int n, m, K;
string s[N];
vector<int> up;
ll ans;
int stk[N], top, ch[N][2];
ll sum1[N], sum2[N];
ll s2(int l, int r) { return 1ll * (l + r) * (r - l + 1) / 2; }
void work1(int l, int r, int maxwid, int value) {
  if (r <= maxwid)
    ans += s2(l, r) * value;
  else if(maxwid < l) ans += sum2[r] - sum2[l - 1];
  else {
    ans += s2(l, maxwid) * value;
    ans += sum2[r] - sum2[maxwid];
  }
}
void work2(int l, int r, int v, int maxwid, int value) {
  if (r <= maxwid)
    ans += 1ll * v * (r - l + 1) * value;
  else if(maxwid < l) ans += 1ll * v * (sum1[r] - sum1[l - 1]);
  else {
    ans += 1ll * v * (maxwid - l + 1) * value;
    ans += 1ll * v * (sum1[r] - sum1[maxwid]);
  }
}
void work3(int l, int r, int maxwid, int value) {
  int v = r - l + 1;
  if (r <= maxwid)
    ans += s2(1, v) * value;
  else if(maxwid < l) ans +=
      (v + l) * (sum1[r] - sum1[l - 1]) - (sum2[r] - sum2[l - 1]);
  else {
    ans += s2(v - (maxwid - l), v) * value;
    ans += (v + l) * (sum1[r] - sum1[maxwid]) - (sum2[r] - sum2[maxwid]);
  }
}
void divide(int l, int r, int i) {
  if (i == -1)
    return;
  divide(l, i - 1, ch[i][0]);
  divide(i + 1, r, ch[i][1]);
  int L = i - l, R = r - i;
  if (L < R)
    swap(L, R);
  // width: 1,2,...,R+1,R+2,...,L+2,L+3,...,L+R+1
  // num:   1,2,...,R+1,R+1,...,R,R-1,...,1
  // ans+=\sum_{wid=1}^{L+R+1} num(wid)*\min(up[i],K/wid)
  int maxwid = (up[i] ? K / up[i] : m);
  work1(1, R, maxwid, up[i]);
  work2(R + 1, L + 1, R + 1, maxwid, up[i]);
  work3(L + 2, L + R + 1, maxwid, up[i]);
}
void solve() {
  top = 0;
  for (int i = 0; i < m; ++i) {
    ch[i][0] = ch[i][1] = -1;
    while (top && up[stk[top]] > up[i])
      ch[i][0] = stk[top--];
    if (top)
      ch[stk[top]][1] = i;
    stk[++top] = i;
  }
  divide(0, m - 1, stk[1]);
}
int main() {
  cin >> n >> m >> K;
  for (int i = 0; i < n; ++i)
    cin >> s[i];
  for (int i = 1; i <= m; ++i) {
    sum1[i] = sum1[i - 1] + (K / i);
    sum2[i] = sum2[i - 1] + i * (K / i);
  }

  up.resize(m);
  for (int j = 0; j < m; ++j)
    up[j] = (s[0][j] == '.');
  solve();
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (s[i][j] == '.')
        ++up[j];
      else
        up[j] = 0;
    }
    solve();
  }
  cout << ans << endl;
  return 0;
}
